<template>
	<view>
		<image src="/static/work1.jpg" mode="" class="img_bg"></image>
		<view class="" style="position: absolute; top: 0; width: 100%;">
			<view class="text-left bg-white padding-l30 margin-l20 margin-r20 padding-r30 margin-t30" style="border-radius: 3%;">
				<view class="text-36 text-bold " style="border-bottom: solid #808080 1upx; text-align: center;">设备巡检信息</view>
				<view class="border-bottom display justify-between align-center">
					<view class="text-36 padding-t30 padding-b30">设备名称</view>
					<view class="text-32 font-gray1 padding-r30">{{danger_listMenu.danger_name?danger_listMenu.danger_name:'-'}}</view>
				</view>
				<view class="border-bottom display justify-between align-center">
					<view class="text-36 padding-t30 padding-b30 ">巡检时间</view>
					<view class="text-32 font-gray1 padding-r30">{{add_time?add_time:'-'}}</view>
				</view>
				<!-- <view class="border-bottom display justify-between align-center">
					<view class="text-36 padding-t30 padding-b30 ">拍照地址</view>
					<view class="text-32 font-gray1 padding-r30">{{danger_listMenu.pic_location?danger_listMenu.pic_location:'-'}}</view>
				</view> -->
				<view class="border-bottom display justify-between align-center">
					<view class="text-36 padding-t30 padding-b30">巡检人</view>
					<view class="text-32 font-gray1 padding-r30">{{danger_listMenu.nickname?danger_listMenu.nickname:'-'}}</view>
				</view>

				
				<view class="border-bottom  justify-between align-center">
					<view class="text-36 padding-t30 padding-b30">现场设备照片</view>
					<image :src="phone" class="addImage padding-r10" v-if="phone!=''" @tap="previewImage(1)
				"></image>
					<image src="/static/add.png" class="addImage" v-else></image>
				</view>
				
				<view class="border-bottom margin-t30">
					<view class="text-36 padding-t30 padding-b30 border-top">巡检内容描述</view>
					<view class="text-32 font-gray1 padding-r30 saytext padding-b30">{{danger_listMenu.remark?danger_listMenu.remark:'暂无巡检备注...'}}</view>
				</view>
				<view class="">
					<button @click="sign()" class="loginButton margin-t30" :disabled="disable_check">点击进行指派</button>
				</view>
			</view>
		</view>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				uid: '',
				token: '',
				xunjian_id: '',
				danger_listMenu: {},
				add_time: '',
				phone: '',
				phone1: '',
				phone2: '',
				zhuangtai: '',
				sird_id: '',
				rectify_user: '',
				is_assign: 0,
				disable_check: false,
				id: '',



			}
		},
		onLoad: function(options) {

			this.uid = uni.getStorageSync('user').uid;
			this.token = uni.getStorageSync('user').token;

			this.add_time = options.time
			this.zhuangtai = options.zhuangtai
			this.id = options.id
			this.getXunjian(options.id)

		},
		methods: {
			getXunjian(e) {
				var that = this
				uni.request({
					url: 'https://aqmore.sxpz.vip/AppApi/SafetyInspection/getInspectionDetail?uid=' + this.uid + '&token=' + this.token +
						'&id=' + e,
					method: 'GET',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					success: function(res) {
						console.log(res)
						that.danger_listMenu = res.data.datas
						console.log(that.danger_listMenu)
						that.phone = that.danger_listMenu.inspection_img
						that.sird_id = that.danger_listMenu.sird_id
						that.xunjian_id = that.danger_listMenu.id
						that.rectify_user = that.danger_listMenu.rectify_user
						console.log(that.danger_listMenu.is_assign)
						that.is_assign = that.danger_listMenu.is_assign
						console.log(that.is_assign)
						// if (that.is_assign == 0) {
						// 	that.disable_check = true
						// }
					}
				})

			},
			previewImage: function(index) {
				var a={} 
				Array.from(a)
				console.log(a)
				 a[0] = this.phone
				 console.log(a)
				 var nameArray=[]
				 for(var i in a){
					 nameArray.push(a[i])
				 }
				 console.log(nameArray)
				uni.previewImage({
					current: index,
					urls: nameArray,
					success: function(res) {
						console.log(res)
					},
					fail: function(res) {
						console.log(res)
					}
				})
			},
			sign() {
				uni.navigateTo({
					url: 'equipmentDetailDetail?id=' + this.id
				})
			},
		}
	}
</script>

<style>
	page {
		margin: 0;
		padding: 0;
		/* background-color: #0d98ed; */
	}

	.loginButton {
		height: 98upx;
		line-height: 98upx;
		background: #65caff;
		box-shadow: 0 2upx 10upx 0 rgba(115, 241, 255, 0.8);
		border-radius: 49upx;
		color: #fff;
		text-align: center;
		z-index: 99;
		position: relative;
	}
</style>
